<?php


namespace app\app\controller;


class Explore extends Base
{

    public function __construct()
    {
        parent::__construct();
    }

    public function indexV1()
    {

        $page = input('page', 0, 'intval');
        if ($page < 1) {
            $page = 1;
        }
        $type_id = input('type_id', 0, 'intval');
        if ($type_id < 1) {
            $type_id = 1;
        }
        $data = cache('ExploreNew_list_' . $type_id . '_pagev1_' . $page);
//
        if (empty($data)) {
            $data = [];
            $faxians = [];
//            $this->dumText('开始处理发现索引json');
            $list = db('explore')->where('is_show', 1)->where('type_id', $type_id)->order('sort', 'asc')->order('time_added', 'desc')->order(
                'id',
                'desc'
            )->paginate(6);
            foreach ($list as $faxian) {
                $faxian['xilie_name'] = $faxian['name'];
                $faxian['xilie_content'] = $faxian['content'];
                $faxian['xilie_id'] = $faxian['id'];
                $faxian['vod_pic_slide'] = $faxian['fengmian'];
                $faxians[]=$faxian;
            }
            $data['list'] = $faxians;
            $data['lastPage'] = $list->lastPage();
            $data['currentPage'] = $list->currentPage();
            $data['listRows'] = $list->listRows();
            cache('ExploreNew_list_' . $type_id . '_pagev1_' . $page, $data, 1200);
        }
        $this->success('获取成功', $data);
    }
}